package server

import (
	"google.golang.org/grpc"
	"log"
	"net"
	"saleforce/sf-backend-gateway/config"
	"strconv"
)

func StartGRPCServer(config *config.ServerConfig) {
	port := strconv.FormatUint(config.Port, 10)
	lis, err := net.Listen("tcp", ":"+port)
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	grpcServer := grpc.NewServer()
	log.Println("✅ gRPC 服务启动在端口 :" + port)
	if err := grpcServer.Serve(lis); err != nil {
		log.Fatalf("failed to serve: %v", err)
	}
}
